package com.ifs.exception;

import com.atguigu.yygh.common.result.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author benmo
 * @data 2021/12/23
 * @project IntelliJ IDEA
 * @package com.atguigu.yygh.common.exception
 */

@RestControllerAdvice
public class GlobalExceptionHandle {

    @ExceptionHandler(Exception.class)
    public Result error(Exception e){
        e.printStackTrace();
        return Result.fail();
    }

    @ExceptionHandler(YyghException.class)
    public Result yyghError(Exception e){
        e.printStackTrace();
        return Result.fail();
    }
}
